package com.demos.webcommon.缓存;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository("CacheDao")
public class dao {
    @Autowired
    private JdbcTemplate template;

    public Map<String, Object> getById(String id){
        return template.queryForMap("select * from table1 where id=?", id);
    }
    public List<Map<String, Object>> list(){
        return template.queryForList("select * from table1");
    }

    public int update(String id, String name){
        return template.update("update table1 set name=? where id=?", name, id);
    }
}
